<?php

$cars = array("Volvo","BMW","Toyota");

$cars[2] = "ferrari";       //修改元素值
echo "我的小目标$cars[2]";


echo "<pre>";
print_r($cars);         //调试，发布时注释或删除
echo count($cars);      //计算元素值个数ֵ�

echo "<hr/>";
echo "foreach ::::.<br/>";
foreach ($cars as $value) {
    echo $value."<br/>";
}


echo "<hr/>";
echo "for.<br/>";
$len = count($cars);
for ($i = 0; $i < $len; $i++){
    echo $cars[$i]."<br/>";
}

$grades = array("一","二","三","四","五","六","七","八","九","十");
?>
    <form>
        
       我的第 <select name="grade">
        <?php foreach($grades as $value) : ?>
        <option value="<?php echo $value; ?>"><?php echo $value; ?></option>
        <?php endforeach ; ?>
       </select> 辆<?php echo $cars[2];?>跑车！
        
    </form>
<?php
    $message = array(
        'pic' => '<img src="images/3.jpg" alt="" />',
        'name' => "avatar",
        'content' => "天天好心情111  <span> (来自火星“女侠”的留言)</span>",
        'sex' => "male"
    );

    foreach ($message as $key => $value) {
        echo $key . '=>' . $value."<br/>";
    
}
?>